<%--
  Created by IntelliJ IDEA.
  User: YN
  Date: 2018/5/14
  Time: 8:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%String path = request.getContextPath();%>
<html>
<head>
    <title>Title</title>
</head>
<link rel="stylesheet" type="text/css" href="<%=path%>/easyUI/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="<%=path%>/easyUI/themes/icon.css">
<script type="text/javascript" src="<%=path%>/easyUI/jquery.min.js"></script>
<script type="text/javascript" src="<%=path%>/easyUI/jquery.easyui.min.js"></script>
<script type="text/javascript">
    function delAll(){
        var ids="";
        $(":checkbox[name='check']:checked").map(function(){
            ids+=","+$(this).val();
        })
        ids=ids.substring(1)
        alert(ids)
        $.ajax({
            type:"post",
            url:"delAll",
            data:{ids:ids},
            success:function (msg) {
                if(msg=="ok"){
                    alert("删除成功")
                    location.href="/list"

                }
            }
        })
    }

</script>
<body>
        <input type="button" value="批量删除" onclick="delAll()">
        <table>
            <tr>
                <td></td>
                <td>用户编号</td>
                <td>用户账号</td>
                <td>用户性别</td>
                <td>用户权限</td>
            </tr>
            <c:forEach items="${users}" var="u">
                <tr>
                    <td><input type="checkbox" name="check" value="${u.id}"></td>
                    <td>${u.id}</td>
                    <td>${u.username}</td>
                    <td>${u.sex}</td>
                    <td>
                        <c:forEach items="${u.roles}" var="r">
                            ${r.role}
                        </c:forEach>
                    </td>
                </tr>
            </c:forEach>
            <tr>
                <td colspan="10">
                    <a href="/list?cpage=1">首页</a>
                    <a href="/list?cpage=${page.prevPage}">上一页</a>
                    <a href="/list?cpage=${page.nextPage}">下一页</a>
                    <a href="/list?cpage=${page.lastPage}">末页</a>
                </td>
            </tr>
        </table>
</body>
</html>
